package com.ivy.irublesson.utils;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by Administrator on 2017/10/12.
 */

public class MyOpenHelper extends SQLiteOpenHelper {

    public MyOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory,
                        int version) {
        super(context, name, factory, version);
    }


    public void onCreate(SQLiteDatabase db) {
        //school(id,sname,listpath , listcookie ,referer,cookiepath ,coursepath)
        String sql = "create table school(id integer primary key autoincrement ,  sname varchar(20) ,listpath varchar(100) ,listcookie varchar(100) ,referer varchar(100) ,cookiepath varchar(100) ,coursepath varchar(100))";
        db.execSQL(sql);
        String sql1 = "create table teacher(id integer primary key autoincrement , tname varchar(20)  , tid varchar(20) , sid integer)";
        db.execSQL(sql1);
        String sql2 = "create table tcontent(id integer primary key autoincrement, info varchar(200)   , weekday integer , time integer , tid varchar(20))";
        db.execSQL(sql2);
    }


    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
       // db.execSQL("alter table info add age integer");
    }
}
